package com.zhang.controller;


import com.zhang.service.ShoppingSysCustomerService;
import com.zhang.units.LoginUnits;
import com.zhang.vo.CustomerLoginVo;
import com.zhang.vo.RegisterVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ZhangD
 * @since 2021-07-13
 */
@RestController
@RequestMapping("/shopping-sys-customer")
public class ShoppingSysCustomerController {

    @Autowired
    private ShoppingSysCustomerService shoppingSysCustomerService;

    /**
     * 登陆
     */
    @PostMapping("/login")
    public LoginUnits login(@RequestBody CustomerLoginVo customerLoginVo) {
        return shoppingSysCustomerService.login(customerLoginVo);

    }

    /**
     * 检查用户名是否存在
     */
    @PostMapping("/register")
    public LoginUnits preregist(@RequestBody CustomerLoginVo customerLoginVo) {
        return shoppingSysCustomerService.preregist(customerLoginVo);

    }
    /**
     * 注册
     */
    @PostMapping("/register1")
    public LoginUnits regist(@RequestBody RegisterVo registerVo) {
        return shoppingSysCustomerService.regist(registerVo);

    }

}



